#include <stdio.h>

union memory
{
    int num;
    char chnum[4];
};

int main(int argc, const char *argv[])
{
     union memory test;

     test.num = 0x12345678;
     if(test.chnum[0] == 0x78)
     {
         puts("The computer is small end");
     }
     else
     {
         puts("The computer is big end");
     }

#if 0
    char *p = NULL;
    int a = 0x12345678;

    p = (char *)(&a);
    
    if(*p == 0x78)
    {
        puts("small end");  //当前计算机为小端模式
    }
    else
    {
        puts("big end");    //当前计算机为大端模式
    }
#endif

    return 0;
}
